package com.cloud.bssp.designpatterns.observer;

import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.schedulers.Schedulers;

/**
 * @description： 测试RxJava，什么是RxJava= Observer + 异步处理（schedulers）
 * @author：weirx
 * @date：2021/10/21 16:47
 * @version：3.0
 */
public class RxJavaTest {

    public static void main(String[] args) throws InterruptedException {
        Observable.create(emitter -> emitter.onNext("hello"))
                .observeOn(Schedulers.newThread())
                .subscribe(s -> System.out.println(Thread.currentThread().getName() + "-" + s));

        Thread.sleep(1000);
    }

}
